package com.qf.admin.controller;

import com.qf.common.http.Result;
import com.qf.entiy.dto.Admin;
import com.qf.entiy.po.LoginAdmin;
import com.qf.entiy.vo.JqueryTreeView;
import com.qf.service.impl.AdminModuleService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class IndexController {
    @Autowired
    private AdminModuleService adminModuleService;
    @RequestMapping("index")
    public String toIndex(Model model) {
        return "index";
    }

    //list页面左侧模块菜单栏加载
    @RequestMapping("func-list")
    @ResponseBody
    public Result<List<JqueryTreeView>> getModuleList(LoginAdmin loginAdmin){
        return Result.success(adminModuleService.getModuleByAdminId(loginAdmin.getId()));
    }

    //登录权限的实验
//    @RequiresPermissions(value = {"ADMINISTRATOR"})
//    @RequestMapping("test.do")
//    @ResponseBody
//    public Result<String> doTest() {
//        return Result.success("我是老师");
//    }

}
